﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Web;
using System.Web.Mvc;

namespace BarManager.UI.Web.HtmlHelpers
{
    public static class TimeHelper
    {
        public static MvcHtmlString TimePicker(this HtmlHelper html, DateTime value, string id)
        {
            TagBuilder divTag = new TagBuilder("div");
            divTag.AddCssClass("time input-append");
                        
            TagBuilder spanTag = new TagBuilder("span");
            spanTag.AddCssClass("add-on");
            
            TagBuilder iTag = new TagBuilder("i");
            iTag.MergeAttribute("data-time-icon", "icon-time");
            iTag.MergeAttribute("data-date-icon", "icon-calendar");

            spanTag.InnerHtml += iTag.ToString();
            divTag.InnerHtml += "<input data-format=\"hh:mm\" type=\"text\"  id=\"" + id + "\"  class=\"input-mini\" value=\"" + value.ToString("HH:mm") + "\">"; // inputTag.ToString();
            divTag.InnerHtml += spanTag.ToString();

            return MvcHtmlString.Create(divTag.ToString());
        }
    }
}